<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>Duplex</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>


<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/Duplex.Application.html">Duplex.Application</a></li>
  <li><a href="../modules/Duplex.Applications.Effect.html">Duplex.Applications.Effect</a></li>
  <li><a href="../modules/Duplex.Applications.GridPie.html">Duplex.Applications.GridPie</a></li>
  <li><a href="../modules/Duplex.Applications.Hydra.html">Duplex.Applications.Hydra</a></li>
  <li><a href="../modules/Duplex.Applications.Instrument.html">Duplex.Applications.Instrument</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.GridLayout.html">Duplex.Applications.Keyboard.GridLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.HarmonicLayout.html">Duplex.Applications.Keyboard.Layouts.HarmonicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.IsomorphicLayout.html">Duplex.Applications.Keyboard.Layouts.IsomorphicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.PianoLayout.html">Duplex.Applications.Keyboard.Layouts.PianoLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.html">Duplex.Applications.Keyboard</a></li>
  <li><a href="../modules/Duplex.Applications.Matrix.html">Duplex.Applications.Matrix</a></li>
  <li><a href="../modules/Duplex.Applications.Metronome.html">Duplex.Applications.Metronome</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.Bindings.html">Duplex.Applications.MidiActions.Bindings</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.html">Duplex.Applications.MidiActions</a></li>
  <li><a href="../modules/Duplex.Applications.Mixer.html">Duplex.Applications.Mixer</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_group.html">Duplex.Applications.Mlrx.Mlrx_group</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_note.html">Duplex.Applications.Mlrx.Mlrx_note</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_pos.html">Duplex.Applications.Mlrx.Mlrx_pos</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_track.html">Duplex.Applications.Mlrx.Mlrx_track</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.html">Duplex.Applications.Mlrx</a></li>
  <li><a href="../modules/Duplex.Applications.Navigator.html">Duplex.Applications.Navigator</a></li>
  <li><a href="../modules/Duplex.Applications.NotesOnWheels.html">Duplex.Applications.NotesOnWheels</a></li>
  <li><a href="../modules/Duplex.Applications.PatternCursor.html">Duplex.Applications.PatternCursor</a></li>
  <li><a href="../modules/Duplex.Applications.PatternSequence.html">Duplex.Applications.PatternSequence</a></li>
  <li><a href="../modules/Duplex.Applications.Recorder.html">Duplex.Applications.Recorder</a></li>
  <li><a href="../modules/Duplex.Applications.Repeater.html">Duplex.Applications.Repeater</a></li>
  <li><a href="../modules/Duplex.Applications.Rotate.html">Duplex.Applications.Rotate</a></li>
  <li><a href="../modules/Duplex.Applications.StepSequencer.html">Duplex.Applications.StepSequencer</a></li>
  <li><a href="../modules/Duplex.Applications.SwitchConfiguration.html">Duplex.Applications.SwitchConfiguration</a></li>
  <li><a href="../modules/Duplex.Applications.TestPad.html">Duplex.Applications.TestPad</a></li>
  <li><a href="../modules/Duplex.Applications.TrackSelector.html">Duplex.Applications.TrackSelector</a></li>
  <li><a href="../modules/Duplex.Applications.Transport.html">Duplex.Applications.Transport</a></li>
  <li><a href="../modules/Duplex.Applications.UIButtonTest.html">Duplex.Applications.UIButtonTest</a></li>
  <li><a href="../modules/Duplex.Applications.XYPad.html">Duplex.Applications.XYPad</a></li>
  <li><a href="../modules/Duplex.Automation.html">Duplex.Automation</a></li>
  <li><a href="../modules/Duplex.Browser.html">Duplex.Browser</a></li>
  <li><a href="../modules/Duplex.BrowserProcess.html">Duplex.BrowserProcess</a></li>
  <li><strong>Duplex.Canvas</strong></li>
  <li><a href="../modules/Duplex.CanvasPoint.html">Duplex.CanvasPoint</a></li>
  <li><a href="../modules/Duplex.ControlMap.html">Duplex.ControlMap</a></li>
  <li><a href="../modules/Duplex.Device.html">Duplex.Device</a></li>
  <li><a href="../modules/Duplex.Display.html">Duplex.Display</a></li>
  <li><a href="../modules/Duplex.Globals.html">Duplex.Globals</a></li>
  <li><a href="../modules/Duplex.Message.html">Duplex.Message</a></li>
  <li><a href="../modules/Duplex.MessageStream.html">Duplex.MessageStream</a></li>
  <li><a href="../modules/Duplex.MidiDevice.html">Duplex.MidiDevice</a></li>
  <li><a href="../modules/Duplex.OscClient.html">Duplex.OscClient</a></li>
  <li><a href="../modules/Duplex.OscDevice.html">Duplex.OscDevice</a></li>
  <li><a href="../modules/Duplex.OscVoiceMgr.html">Duplex.OscVoiceMgr</a></li>
  <li><a href="../modules/Duplex.Preferences.html">Duplex.Preferences</a></li>
  <li><a href="../modules/Duplex.ProcessSlicer.html">Duplex.ProcessSlicer</a></li>
  <li><a href="../modules/Duplex.RoamingDSP.html">Duplex.RoamingDSP</a></li>
  <li><a href="../modules/Duplex.Scheduler.html">Duplex.Scheduler</a></li>
  <li><a href="../modules/Duplex.StateController.html">Duplex.StateController</a></li>
  <li><a href="../modules/Duplex.UIButton.html">Duplex.UIButton</a></li>
  <li><a href="../modules/Duplex.UIButtonStrip.html">Duplex.UIButtonStrip</a></li>
  <li><a href="../modules/Duplex.UIComponent.html">Duplex.UIComponent</a></li>
  <li><a href="../modules/Duplex.UIKey.html">Duplex.UIKey</a></li>
  <li><a href="../modules/Duplex.UIKeyPressure.html">Duplex.UIKeyPressure</a></li>
  <li><a href="../modules/Duplex.UILabel.html">Duplex.UILabel</a></li>
  <li><a href="../modules/Duplex.UIPad.html">Duplex.UIPad</a></li>
  <li><a href="../modules/Duplex.UIPitchBend.html">Duplex.UIPitchBend</a></li>
  <li><a href="../modules/Duplex.UISlider.html">Duplex.UISlider</a></li>
  <li><a href="../modules/Duplex.UISpinner.html">Duplex.UISpinner</a></li>
  <li><a href="../modules/Duplex.WidgetHooks.html">Duplex.WidgetHooks</a></li>
  <li><a href="../modules/Duplex.WidgetKeyboard.html">Duplex.WidgetKeyboard</a></li>
  <li><a href="../modules/Duplex.html">Duplex</a></li>
  <li><a href="../modules/main.html">main</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>Duplex.Canvas</code></h1>
<p>Employed by the UIComponents to represent their visual state</p>

<p>The canvas is a two-dimensional table of CanvasPoints which can be resized.</p>
<p>
Each CanvasPoint specifies both the visual appearance of a button (via color or text), as well as any sort of value that the UIComponent might define. </p>

<p>Also, the canvas is the layer we perform our updates "through". By checking the "delta", we can decide if something has <em>actually</em> changed before the update is performed. </p>

<p>Think of it as pre-optimization - both cabled MIDI and wireless devices are capable of choking or skipping messages. </p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#__init">__init (device)</a></td>
	<td class="summary">Initialize the Canvas class</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#set_size">set_size (width, height)</a></td>
	<td class="summary">Call whenever the size of the parent UIComponent changes</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#write">write (point, x, y)</a></td>
	<td class="summary">Write a single point to the canvas at the provided x/y coordinates</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#fill">fill (point)</a></td>
	<td class="summary">Fill/flood entire canvas with given point</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#check_delta">check_delta (point, x, y)</a></td>
	<td class="summary">If point is different from existing value, mark the canvas as changed
 both color, text and value are considered when doing the comparison</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#clear_delta">clear_delta ()</a></td>
	<td class="summary">After the display has finished drawing the object, this is called
 to clear the delta buffer and mark the canvas as unchanged</td>
	</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#self.delta">self.delta</a></td>
	<td class="summary">(table) difference buffer, cleared on each update</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.buffer">self.buffer</a></td>
	<td class="summary">(table) the current, complete representation</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.clear">self.clear</a></td>
	<td class="summary">table of extraneous points that should be cleared on next update
 created when the canvas is reduced in size, and contains just a
 simple set of booleans (the Display class will create the empty
 points when needed)</td>
	</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#self.has_changed">self.has_changed</a></td>
	<td class="summary">(bool) flag when we need to update the display</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.width">self.width</a></td>
	<td class="summary">(int) canvas width</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.height">self.height</a></td>
	<td class="summary">(int) canvas height</td>
	</tr>
</table>

<br/>
<br/>


    <h2><a name="Functions"></a>Functions</h2>
    <dl class="function">
    <dt>
    <a name = "__init"></a>
    <strong>__init (device)</strong>
    </dt>
    <dd>
    Initialize the Canvas class


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">device</span>
         (Device)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "set_size"></a>
    <strong>set_size (width, height)</strong>
    </dt>
    <dd>
    Call whenever the size of the parent UIComponent changes


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">width</span>
         (int)
        </li>
        <li><span class="parameter">height</span>
         (int)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "write"></a>
    <strong>write (point, x, y)</strong>
    </dt>
    <dd>
    Write a single point to the canvas at the provided x/y coordinates


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">point</span>
         (<a href="../modules/Duplex.CanvasPoint.html#">Duplex.CanvasPoint</a>)
        </li>
        <li><span class="parameter">x</span>
         (int)
        </li>
        <li><span class="parameter">y</span>
         (int)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "fill"></a>
    <strong>fill (point)</strong>
    </dt>
    <dd>
    Fill/flood entire canvas with given point


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">point</span>
         (<a href="../modules/Duplex.CanvasPoint.html#">Duplex.CanvasPoint</a>)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "check_delta"></a>
    <strong>check_delta (point, x, y)</strong>
    </dt>
    <dd>
    If point is different from existing value, mark the canvas as changed
 both color, text and value are considered when doing the comparison


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">point</span>
         (<a href="../modules/Duplex.CanvasPoint.html#">Duplex.CanvasPoint</a>)
        </li>
        <li><span class="parameter">x</span>
         (int)
        </li>
        <li><span class="parameter">y</span>
         (int)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "clear_delta"></a>
    <strong>clear_delta ()</strong>
    </dt>
    <dd>
    After the display has finished drawing the object, this is called
 to clear the delta buffer and mark the canvas as unchanged







</dd>
</dl>
    <h2><a name="Tables"></a>Tables</h2>
    <dl class="function">
    <dt>
    <a name = "self.delta"></a>
    <strong>self.delta</strong>
    </dt>
    <dd>
    (table) difference buffer, cleared on each update


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">{</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "self.buffer"></a>
    <strong>self.buffer</strong>
    </dt>
    <dd>
    (table) the current, complete representation


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">{</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "self.clear"></a>
    <strong>self.clear</strong>
    </dt>
    <dd>
    table of extraneous points that should be cleared on next update
 created when the canvas is reduced in size, and contains just a
 simple set of booleans (the Display class will create the empty
 points when needed)







</dd>
</dl>
    <h2><a name="Fields"></a>Fields</h2>
    <dl class="function">
    <dt>
    <a name = "self.has_changed"></a>
    <strong>self.has_changed</strong>
    </dt>
    <dd>
    (bool) flag when we need to update the display







</dd>
    <dt>
    <a name = "self.width"></a>
    <strong>self.width</strong>
    </dt>
    <dd>
    (int) canvas width







</dd>
    <dt>
    <a name = "self.height"></a>
    <strong>self.height</strong>
    </dt>
    <dd>
    (int) canvas height







</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
